home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15110 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: newsfeed.internetmci.com!iol!usenet
  2. From: David Byrden <Goyra@iol.ie>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: The STL and nested structures
  5. Date: 3 Apr 1996 19:18:54 GMT
  6. Organization: Ireland On-Line
  7. Message-ID: <4juiuu$q4c@nuacht.iol.ie>
  8. References: <4ju9q7$fa1$1@mhadg.production.compuserve.com>
  9. NNTP-Posting-Host: dialup-327.dublin.iol.ie
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22KIT (Windows; I; 16bit)
  14.  
  15. Alan Huff <74312.2300@CompuServe.COM> wrote:
  16. >I am having a problem using the STL with structures defined within 
  17. >a class definition.  Consider the following code fragment.
  18. >
  19. >>#include <vector.h>
  20. >>class Bar {
  21. >>   struct Foo {
  22. >>      int   value;
  23. >>   };
  24. >>
  25. >>   vector< Foo > fooContainer;
  26. >>}
  27. >
  28. >The compiler I am using (VC 4.1) refuses to compile.  An error is 
  29. >generated the says "'Foo' : undeclared identifier" at line 75 in 
  30. >vector.h.
  31. >
  32. >Line 75 of vector.h
  33. >>   vector(size_type n, const T& value = T()) { ...
  34. >
  35. >If I move the structure Foo out of the class and into the global 
  36. >namespace there are no compilation errors.
  37. >
  38. >What am I missing??
  39.  
  40.  
  41.             Check out Microsoft's online bug list for VC4. I remember (my 
  42. docs are elsewhere) one bug which was a template class being instantiated 
  43. by use as a default parameter, and that line 75 did used to cause it for 
  44. me. The solution was to force class instantiation previous to that line.
  45.  
  46.                                     David
  47.  
  48.  
  49.